package com.xjgzinfo.usdp.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * 地图
 *
 * @author jxw
 */
@Entity
@Table(name = "blade_visual_map")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class BladeVisualMap implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GenericGenerator(name = "snowFlakeIdGenerator", strategy = "com.xjgzinfo.usdp.domain.util.SnowFlakeIdGenerator")
    @GeneratedValue(generator = "snowFlakeIdGenerator", strategy = GenerationType.SEQUENCE)
    @JsonFormat(shape = JsonFormat.Shape.NUMBER)
    //@GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 地图名称
     */
    @Size(max = 255)
    @Column(name = "name", length = 255)
    private String name;

    /**
     * 地图数据
     */
    @Lob
    @Column(name = "data")
    private String data;

    // jhipster-needle-entity-add-field - JHipster will add fields here
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public BladeVisualMap name(String name) {
        this.name = name;
        return this;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public BladeVisualMap data(String data) {
        this.data = data;
        return this;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof BladeVisualMap)) {
            return false;
        }
        return id != null && id.equals(((BladeVisualMap) o).id);
    }

    @Override
    public int hashCode() {
        return 31;
    }

    // prettier-ignore
    @Override
    public String toString() {
        return "BladeVisualMap{" +
                "id=" + getId() +
                ", name='" + getName() + "'" +
                ", data='" + getData() + "'" +
                "}";
    }
}
